Conversation
This is to address the issue found in apache/iceberg#2328
c5c6536 to
419c322
Compare
Codecov Report
@@ Coverage Diff @@
## main #1016 +/- ##
============================================
+ Coverage 70.53% 70.60% +0.07%
Complexity 122 122
============================================
Files 240 241 +1
Lines 8955 9003 +48
Branches 846 847 +1
============================================
+ Hits 6316 6357 +41
- Misses 2202 2210 +8
+ Partials 437 436 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
snazy
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 6 files reviewed, 6 unresolved discussions (waiting on @rymurr)
a discussion (no related file):
Being able to configure network timeouts is a good improvement!
Mind making the connect-timeout configurable as well?
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 68 at r1 (raw file):
private String password; private boolean tracing; private int readTimeout = 10;
I'd prefer milliseconds here, just because almost every HTTP client implementation uses milliseconds.
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 68 at r1 (raw file):
private String password; private boolean tracing; private int readTimeout = 10;
Just thinking: sun.net.NetworkClient uses the system property sun.net.client.defaultReadTimeout here, maybe we should use the same property as well, but just default to a > 0 default value. WDYT?
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 177 at r1 (raw file):
* @return {@code this} */ public Builder withReadTimeout(int readTimeout) {
Rename the param to readTimeoutMillis
clients/client/src/main/java/org/projectnessie/client/http/HttpClient.java, line 101 at r1 (raw file):
private ObjectMapper mapper; private SSLContext sslContext; private int readTimeout = 10;
I'd maybe give it a bit more by default - maybe 15 or 20 seconds.
clients/client/src/test/java/org/projectnessie/client/http/TestHttpClient.java, line 70 at r1 (raw file):
@Test void testTimeout() { HttpHandler handler = h -> {
Looks like this test runs for quite a long time. Guess, this probably needs some Mockito magic.
rymurr
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 6 files reviewed, 6 unresolved discussions (waiting on @rymurr and @snazy)
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 68 at r1 (raw file):
Previously, snazy (Robert Stupp) wrote…
I'd prefer milliseconds here, just because almost every HTTP client implementation uses milliseconds.
Done.
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 68 at r1 (raw file):
Previously, snazy (Robert Stupp) wrote…
Just thinking:
sun.net.NetworkClientuses the system propertysun.net.client.defaultReadTimeouthere, maybe we should use the same property as well, but just default to a > 0 default value. WDYT?
Done.
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 177 at r1 (raw file):
Previously, snazy (Robert Stupp) wrote…
Rename the param to
readTimeoutMillis
Done.
clients/client/src/main/java/org/projectnessie/client/http/HttpClient.java, line 101 at r1 (raw file):
Previously, snazy (Robert Stupp) wrote…
I'd maybe give it a bit more by default - maybe 15 or 20 seconds.
Done.
clients/client/src/test/java/org/projectnessie/client/http/TestHttpClient.java, line 70 at r1 (raw file):
Previously, snazy (Robert Stupp) wrote…
Looks like this test runs for quite a long time. Guess, this probably needs some Mockito magic.
Done.
snazy
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 6 files reviewed, 4 unresolved discussions (waiting on @rymurr)
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 70 at r2 (raw file):
private boolean tracing; private int readTimeoutMillis = Integer.parseInt(System.getProperty("sun.net.client.defaultReadTimeout", "25000")); private int connectionTimeoutMillis = Integer.parseInt(System.getProperty("sun.net.client.defaultConnectionTimeout", "25000"));
That's maybe quite long for a TCP connect-timeout. 3 or 5 seconds is probably good enough.
clients/client/src/main/java/org/projectnessie/client/http/HttpRequest.java, line 149 at r2 (raw file):
} catch (SocketTimeoutException e) { throw new HttpClientReadTimeoutException( String.format("Cannot finish request. Timeout while waiting for response with a timeout of %ds", readTimeoutMillis / 1000), e);
The exception message is wrong (both connect + read throw a SocketTimeoutExcepiton), maybe just mention both timeouts (in millis).
clients/client/src/test/java/org/projectnessie/client/http/TestHttpClient.java, line 80 at r2 (raw file):
try (TestServer server = new TestServer(handler)) { get(server.getAddress(), 15000, 1).get().readEntity(ExampleBean.class); Assertions.fail();
the Assertions.fail() is superfluous here ;)
rymurr
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 6 files reviewed, 4 unresolved discussions (waiting on @rymurr and @snazy)
clients/client/src/main/java/org/projectnessie/client/NessieClient.java, line 70 at r2 (raw file):
Previously, snazy (Robert Stupp) wrote…
That's maybe quite long for a TCP connect-timeout. 3 or 5 seconds is probably good enough.
Done.
clients/client/src/main/java/org/projectnessie/client/http/HttpRequest.java, line 149 at r2 (raw file):
Previously, snazy (Robert Stupp) wrote…
The exception message is wrong (both connect + read throw a SocketTimeoutExcepiton), maybe just mention both timeouts (in millis).
Where did you see that? I saw a different exception for connect. ConnectException or something.
clients/client/src/test/java/org/projectnessie/client/http/TestHttpClient.java, line 80 at r2 (raw file):
Previously, snazy (Robert Stupp) wrote…
the Assertions.fail() is superfluous here ;)
yup, removed.
snazy
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 6 files reviewed, 2 unresolved discussions (waiting on @rymurr)
clients/client/src/main/java/org/projectnessie/client/http/HttpRequest.java, line 149 at r2 (raw file):
Previously, rymurr (Ryan Murray) wrote…
Where did you see that? I saw a different exception for connect.
ConnectExceptionor something.
In the javadoc for java.net.Socket#connect(java.net.SocketAddress, int). But since you mention it, IIRC it's really ConnectException - interesting, that it's different from the javadoc.
This is to address the issue found in apache/iceberg#2328
This change is